package com.groupbuying.customer.connector;

import feign.Param;
import org.aspectj.apache.bcel.classfile.Code;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @Author: m
 * @Description:
 * @Date: Create in 16:29 2019/10/22
 */
@Service
@FeignClient("service-sysconfig")
public interface WechatAliFeign {

    /**
     * 通过code获取小程序的openID和sessionKey
     *
     */
    @GetMapping(value = "/Wechat/weChatMiniApp/getOpenidAndSessionKeyByCode")
    Map<String, String> getOpenidAndSessionKeyByCode(@RequestParam("code") String code,@RequestParam("indicate") String indicate);

    /**
     * 根据前端传入code获取对应微信公众号openId及sessionKey
     *
     */
    @GetMapping(value = "/Wechat/weChatPublicApp/getMPOpenidByCode")
    Map<String, String> getMPOpenidByCode (@RequestParam("code") String code,@RequestParam("indicate") String indicate);

    /**
     * 公众号accessToken
     */
    @GetMapping(value = "/Wechat/weChatPublicApp/getAccessToken")
    String getAccessToken(@RequestParam("indicate") String indicate);

    /**
     * accessToken小程序
     */
    @GetMapping(value = "/Wechat/weChatMiniApp/getProgramAccessToken")
    String getProgramAccessToken(@RequestParam("indicate") String indicate);

    /**
     * 解密
     */
    @GetMapping(value = "/Wechat/weChatMiniApp/decryptData")
    Map<String,String> decryptData(@RequestParam("encryptedData") String encryptedData, @RequestParam("iv") String iv, @RequestParam("code") String code,@RequestParam("indicate") String indicate);

    /**
     * 支付宝用户认证授权获取alipayUserId和accessToken
     * @param authCode
     * @return map
     * @throws Exception
     */
    @GetMapping("/aliMiniApp/aliGetUserIdAccessCodeByAuthCode")
    Map<String, String> aliGetUserIdAccessCodeByAuthCode(@RequestParam("authCode") String authCode,@RequestParam("indicate") String indicate) throws Exception;

    /**
     * 支付宝用户授权手机号解密信息接口
     * @param params
     * @return map
     */
    @PostMapping("/aliMiniApp/aliDecodeUserEncryptedData")
    Map<String, String> aliDecodeUserEncryptedData(@RequestParam Map<String, String> params);





}
